﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace TestLogRealtimeMonitor.Converters
{
    /// <summary>
    /// 判断文本中是否包含特定内容
    /// </summary>
    public class ContainsContentConverter : IValueConverter
    {
        private string expectedValue;

        public string ExpectedValue
        {
            get { return expectedValue; }
            set { expectedValue = value; }
        }

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return value.ToString().Contains(ExpectedValue);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Binding.DoNothing;
        }
    }
}
